package com.carlinfo.userscenter.users.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 菜单表的POJO
 * 
 * @author wangshMac
 */
public class AMenu
{
	private int id;
	private int parentId;
	private String name;
	private String url;
	private String content;
	private byte showStatus;
	private byte leafStatus;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	/* 字符串描述 */
	private String showStatusStr;
	private String leafStatusStr;
	private String statusStr;
	
	/* 额外字符串,存储结果 */
	private String treeName ; 
	
	/* 关联关系 */
	/* 多对一:一个菜单只能有一个父菜单 */
	private AMenu parentMenu ;
	/* 一对多:一个菜单有多个子菜单 */
	private List<AMenu> childMenuList = new ArrayList<AMenu>();
	/*
	 * 一个菜单有多个角色菜单
	 * */
	private List<ARoleMenu> childRoleMenuList = new ArrayList<ARoleMenu>();

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getParentId()
	{
		return parentId;
	}

	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getShowStatus()
	{
		return showStatus;
	}

	public void setShowStatus(byte showStatus)
	{
		this.showStatus = showStatus;
	}

	public byte getLeafStatus()
	{
		return leafStatus;
	}

	public void setLeafStatus(byte leafStatus)
	{
		this.leafStatus = leafStatus;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public String getShowStatusStr()
	{
		AMenuEnum[] values = AMenuEnum.values() ; 
		for (int i = 0; i < values.length; i++)
		{
			AMenuEnum menuEnumTemp = values[i];
			/* 
			 * toString:变量名
			 * name:枚举的键,
			 * getstatus:枚举的值
			 * */
			if(menuEnumTemp.toString().startsWith("SHOW_STATUS"))
			{
				if(menuEnumTemp.getStatus() == this.showStatus)
				{
					this.showStatusStr = menuEnumTemp.getName(); 
				}
			}
			//System.out.println(adminsEnumTemp.getName() + "=====>" + adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return showStatusStr;
	}

	public String getLeafStatusStr()
	{
		AMenuEnum[] values = AMenuEnum.values() ; 
		for (int i = 0; i < values.length; i++)
		{
			AMenuEnum menuEnumTemp = values[i];
			/* 
			 * toString:变量名
			 * name:枚举的键,
			 * getstatus:枚举的值
			 * */
			if(menuEnumTemp.toString().startsWith("LEAF_STATUS"))
			{
				if(menuEnumTemp.getStatus() == this.leafStatus)
				{
					this.leafStatusStr = menuEnumTemp.getName(); 
				}
			}
			//System.out.println(adminsEnumTemp.getName() + "=====>" + adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return leafStatusStr;
	}

	public String getStatusStr()
	{
		AMenuEnum[] values = AMenuEnum.values() ; 
		for (int i = 0; i < values.length; i++)
		{
			AMenuEnum menuEnumTemp = values[i];
			/* 
			 * toString:变量名
			 * name:枚举的键,
			 * getstatus:枚举的值
			 * */
			if(menuEnumTemp.toString().startsWith("STATUS"))
			{
				if(menuEnumTemp.getStatus() == this.status)
				{
					this.statusStr = menuEnumTemp.getName(); 
				}
			}
		}
		return statusStr;
	}

	@Override
	public String toString()
	{
		return "AMenu [id=" + id + ", parentId=" + parentId + ", name=" + name + ", url=" + url + ", content=" + content
				+ ", showStatus=" + showStatus + ", leafStatus=" + leafStatus + ", status=" + status + ", createTime="
				+ createTime + ", updateTime=" + updateTime + ", pubTime=" + pubTime + ", showStatusStr="
				+ showStatusStr + ", leafStatusStr=" + leafStatusStr + ", statusStr=" + statusStr + "]";
	}

	public AMenu getParentMenu()
	{
		return parentMenu;
	}

	public void setParentMenu(AMenu parentMenu)
	{
		this.parentMenu = parentMenu;
	}

	public List<AMenu> getChildMenuList()
	{
		return childMenuList;
	}

	public void setChildMenuList(List<AMenu> childMenuList)
	{
		this.childMenuList = childMenuList;
	}

	public String getTreeName()
	{
		return treeName;
	}

	public void setTreeName(String treeName)
	{
		this.treeName = treeName;
	}

	public List<ARoleMenu> getChildRoleMenuList()
	{
		return childRoleMenuList;
	}

	public void setChildRoleMenuList(List<ARoleMenu> childRoleMenuList)
	{
		this.childRoleMenuList = childRoleMenuList;
	}
}
